<html>
<head><meta charset="utf-8"><title>tests for llvm feature leakage · project-inline-asm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/index.html">project-inline-asm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html">tests for llvm feature leakage</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224857367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/224857367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#224857367">(Feb 02 2021 at 11:15)</a>:</h4>
<p>Do we have inline-asm tests in tree that check we don't leak any of the unintended features the LLVM's assembler supports but we don't want to?</p>



<a name="224857520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/224857520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#224857520">(Feb 02 2021 at 11:16)</a>:</h4>
<p>Are you talking about things like <code>{:uid}</code>? Or differences in the actually assembler (LLVM vs GAS)?</p>



<a name="224857543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/224857543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#224857543">(Feb 02 2021 at 11:17)</a>:</h4>
<p>We automatically escape <code>{</code> to <code>{{</code> so it should be impossible to use LLVM's internal template specifiers.</p>



<a name="224860070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/224860070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#224860070">(Feb 02 2021 at 11:45)</a>:</h4>
<p>Yeah, I noticed that we escape <code>$</code> to <code>$$</code>, but I don't think we have a test for this. I think there's value in having one.</p>



<a name="224935059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/224935059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#224935059">(Feb 02 2021 at 20:55)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> I'd be happy to review a PR adding such tests, if you have any interest in writing one.</p>



<a name="224937740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/224937740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#224937740">(Feb 02 2021 at 21:16)</a>:</h4>
<p>Yeah, I will keep this thread as a todo item for myself.</p>



<a name="225369669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/225369669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#225369669">(Feb 05 2021 at 23:02)</a>:</h4>
<p>Huh, it turns out that a literal <code>$$</code> ends up filtered out entirely from the asm. So something like this:</p>
<div class="codehilite"><pre><span></span><code>banana$: nop
b$a$n$a$n$a: nop
</code></pre></div>
<p>will make labels collide as they both end up as plain <code>banana</code>.</p>



<a name="225378174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/225378174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#225378174">(Feb 06 2021 at 01:11)</a>:</h4>
<p>Seems to work correctly in the playground:</p>
<div class="codehilite"><pre><span></span><code>tail call void asm sideeffect alignstack inteldialect &quot;banana$$: nop\0Ab$$a$$n$$a$$n$$a: nop&quot;, &quot;~{dirflag},~{fpsr},~{flags},~{memory}&quot;() #1, !srcloc !2
</code></pre></div>



<a name="225378226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/225378226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#225378226">(Feb 06 2021 at 01:12)</a>:</h4>
<p>Oh it's the assembler that eliminates the <code>$</code>. Well at that point it's not our problem any more.</p>



<a name="225406257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/tests%20for%20llvm%20feature%20leakage/near/225406257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/tests.20for.20llvm.20feature.20leakage.html#225406257">(Feb 06 2021 at 11:41)</a>:</h4>
<p>I think it disappears in llvm-&gt;asm but yeah probably ain't our problem. Pretty weird still tho.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>